package fitness;

import org.jgap.FitnessFunction;
import org.jgap.IChromosome;

import character.Paladin;

public class PaladinFitness extends FitnessFunction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4015345654088541917L;

	@Override
	protected double evaluate(IChromosome profile) {
		Integer strength = (Integer) profile.getGene(0).getAllele();
		Integer agility =  (Integer) profile.getGene(1).getAllele();
		Integer stamina =  (Integer) profile.getGene(2).getAllele();
		Integer intellect =  (Integer) profile.getGene(3).getAllele();
		Integer spirit =  (Integer) profile.getGene(4).getAllele();
		
		Paladin paladin = new Paladin();
		paladin.setStrength(strength);
		paladin.setAgility(agility);
		paladin.setStamina(stamina);
		paladin.setIntellect(intellect);
		paladin.setSpirit(spirit);
		
		double res =  3.989  * paladin.getAttackPower() +
					 35.905  * paladin.getArmor() + 
					  5.319  * paladin.getSpeed() +
					 22.606  * paladin.getResilience() + 
					  3.989  * paladin.getDodgeRating() + 
					  1.197  * paladin.getMana() +
					  1.729  * paladin.getHealth() +
					  3.989  * paladin.getSpellPenetration() +
					  2.660  * paladin.getHaste() + 
					 10.638  * paladin.getHealthRegeneration() +
					  7.979  * paladin.getManaRegeneration();
		return res;
	}
	
}
